package com.fancy.core.service.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fancy.core.dal.UserDao;
import com.fancy.core.model.UserModel;
import com.fancy.core.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	
	@Resource
	private UserDao userDao;
	
	@Override
	public void add(String name, Integer age, Integer sex) {
		UserModel user=new UserModel();
		user.setName(name);
		user.setAge(age);
		user.setSex(sex);
		userDao.insert(user);
		//throw new RuntimeException("Runtime error...");
	}
	
	@Override
	public Integer del(Integer id) {
		return userDao.del(id);
	}
	
	@Override
	public Integer update(UserModel userModel) {
		return userDao.update(userModel);
	}
	
	@Override
	public UserModel get(Integer id) {
		userDao.select(id);
		return userDao.select(id);
	}
	
	@Override
	public List<UserModel> getList(Integer start, Integer count){
		return userDao.selectList(start, count);
	}
	
	@Override
	public Integer getListCount(){
		return userDao.selectListCount();
	}

}
